home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / strchr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  471 b   |  38 lines

  1. #include <string.h>
  2.  
  3. /************************************************************************/
  4.  
  5. #if defined(__GNUC__) && defined(mc68000)
  6.  
  7. asm("
  8.     .globl    _strchr
  9. _strchr:
  10.     movel    sp@(4:W),a0
  11.     movel    sp@(8:W),d0
  12. L2:    cmpb    a0@,d0
  13.     jeq    L1
  14.     tstb    a0@+
  15.     jne    L2
  16.     subal    a0,a0
  17. L1:    movel    a0,d0
  18.     rts
  19. ");
  20.  
  21. #else
  22.  
  23. char *strchr(const char *String, int c)
  24.  
  25. {
  26.   while (*String!=(char)c)
  27.     {
  28.       if (!(*String++))
  29.     {
  30.       String=NULL;
  31.       break;
  32.     }
  33.     }
  34.   return (char *)String;
  35. }
  36.  
  37. #endif
  38.